USE [InventoryManagement]
GO
ALTER TABLE [dbo].[Trouble Cabang] DROP CONSTRAINT [FK_Trouble Cabang_Data Kunjungan]
GO
ALTER TABLE [dbo].[Pick Up] DROP CONSTRAINT [FK_Pick Up_Work Order]
GO
ALTER TABLE [dbo].[Modul Detail] DROP CONSTRAINT [FK_Modul Detail_Inventory Network]
GO
ALTER TABLE [dbo].[Inventory VM] DROP CONSTRAINT [FK_Inventory VM_System Type]
GO
ALTER TABLE [dbo].[Inventory VM] DROP CONSTRAINT [FK_Inventory VM_System Brand]
GO
ALTER TABLE [dbo].[Inventory VM] DROP CONSTRAINT [FK_Inventory VM_Operating System]
GO
ALTER TABLE [dbo].[Inventory VM] DROP CONSTRAINT [FK_Inventory VM_Data Cabang]
GO
ALTER TABLE [dbo].[Inventory Storage] DROP CONSTRAINT [FK_Inventory Storage_System Type]
GO
ALTER TABLE [dbo].[Inventory Storage] DROP CONSTRAINT [FK_Inventory Storage_System Brand]
GO
ALTER TABLE [dbo].[Inventory Storage] DROP CONSTRAINT [FK_Inventory Storage_Data Cabang]
GO
ALTER TABLE [dbo].[Inventory Physical] DROP CONSTRAINT [FK_Inventory Physical_System Type]
GO
ALTER TABLE [dbo].[Inventory Physical] DROP CONSTRAINT [FK_Inventory Physical_System Brand]
GO
ALTER TABLE [dbo].[Inventory Physical] DROP CONSTRAINT [FK_Inventory Physical_Operating System]
GO
ALTER TABLE [dbo].[Inventory Physical] DROP CONSTRAINT [FK_Inventory Physical_Data Cabang]
GO
ALTER TABLE [dbo].[Detail Printer] DROP CONSTRAINT [FK_Detail Printer_Printer]
GO
ALTER TABLE [dbo].[Detail Printer] DROP CONSTRAINT [FK_Detail Printer_Data Cabang]
GO
ALTER TABLE [dbo].[Deployment Unit] DROP CONSTRAINT [FK_Deployment Unit_Data Kunjungan]
GO
ALTER TABLE [dbo].[Deployment Printer] DROP CONSTRAINT [FK_Deployment Printer_Data Kunjungan]
GO
ALTER TABLE [dbo].[Data Kunjungan] DROP CONSTRAINT [FK_Data Kunjungan_Data Cabang]
GO
ALTER TABLE [dbo].[Data Cabang] DROP CONSTRAINT [FK_Data Cabang_Router]
GO
ALTER TABLE [dbo].[Data Cabang] DROP CONSTRAINT [FK_Data Cabang_Provider]
GO
ALTER TABLE [dbo].[Data Cabang] DROP CONSTRAINT [FK_Data Cabang_NAS]
GO
/****** Object:  Table [dbo].[Work Order]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Work Order]
GO
/****** Object:  Table [dbo].[Vendor]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Vendor]
GO
/****** Object:  Table [dbo].[Trouble Cabang]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Trouble Cabang]
GO
/****** Object:  Table [dbo].[System Type]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[System Type]
GO
/****** Object:  Table [dbo].[System Brand]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[System Brand]
GO
/****** Object:  Table [dbo].[RPYear]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[RPYear]
GO
/****** Object:  Table [dbo].[RPMonth]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[RPMonth]
GO
/****** Object:  Table [dbo].[Router]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Router]
GO
/****** Object:  Table [dbo].[Rack Number]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Rack Number]
GO
/****** Object:  Table [dbo].[Provider]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Provider]
GO
/****** Object:  Table [dbo].[Printer]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Printer]
GO
/****** Object:  Table [dbo].[Pick Up]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Pick Up]
GO
/****** Object:  Table [dbo].[Operating System]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Operating System]
GO
/****** Object:  Table [dbo].[NAS]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[NAS]
GO
/****** Object:  Table [dbo].[Modul Detail]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Modul Detail]
GO
/****** Object:  Table [dbo].[Location]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Location]
GO
/****** Object:  Table [dbo].[Inventory VM]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Inventory VM]
GO
/****** Object:  Table [dbo].[Inventory Storage]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Inventory Storage]
GO
/****** Object:  Table [dbo].[Inventory Physical]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Inventory Physical]
GO
/****** Object:  Table [dbo].[Inventory Network]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Inventory Network]
GO
/****** Object:  Table [dbo].[Detail Printer]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Detail Printer]
GO
/****** Object:  Table [dbo].[Deployment Unit]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Deployment Unit]
GO
/****** Object:  Table [dbo].[Deployment Printer]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Deployment Printer]
GO
/****** Object:  Table [dbo].[Data Kunjungan]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Data Kunjungan]
GO
/****** Object:  Table [dbo].[Data Cabang]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Data Cabang]
GO
/****** Object:  Table [dbo].[CR VM]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[CR VM]
GO
/****** Object:  Table [dbo].[CR Storage]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[CR Storage]
GO
/****** Object:  Table [dbo].[CR Physical]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[CR Physical]
GO
/****** Object:  Table [dbo].[CR Network]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[CR Network]
GO
/****** Object:  Table [dbo].[CheckList VM]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[CheckList VM]
GO
/****** Object:  Table [dbo].[CheckList Storage]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[CheckList Storage]
GO
/****** Object:  Table [dbo].[Checklist Physical]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Checklist Physical]
GO
/****** Object:  Table [dbo].[CheckList Network]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[CheckList Network]
GO
/****** Object:  Table [dbo].[Approval]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP TABLE [dbo].[Approval]
GO
/****** Object:  StoredProcedure [dbo].[sp_Select_Task]    Script Date: 2/13/2014 3:46:30 PM ******/
DROP PROCEDURE [dbo].[sp_Select_Task]
GO
USE [InventoryManagement]
GO
/****** Object:  StoredProcedure [dbo].[sp_Select_Task]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[sp_Select_Task]
@Status varchar(200) = NULL,
@Requester varchar(200) = NULL
AS

SELECT a.*,b.wfStatus FROM dbo.Approval a INNER JOIN dbo.[Data Cabang] b ON a.IDChild = b.ID

WHERE b.wfStatus LIKE '%'+ @Status+'%' AND (a.Requester LIKE @Requester OR @Requester IS NULL)

UNION

--tambahan untuk data kunjungan

SELECT a.*,b.wfStatus FROM dbo.Approval a INNER JOIN dbo.[Data Kunjungan] b ON a.IDChild = b.ID

WHERE b.wfStatus LIKE '%'+ @Status+'%' AND (a.Requester LIKE @Requester OR @Requester IS NULL)

UNION

SELECT a.*,b.wfStatus FROM dbo.Approval a INNER JOIN dbo.[CR Storage] b ON a.IDChild = b.ID

WHERE b.wfStatus LIKE '%'+ @Status+'%' AND (a.Requester LIKE @Requester OR @Requester IS NULL)

UNION

SELECT a.*,b.wfStatus FROM dbo.Approval a INNER JOIN dbo.[CR Network] b ON a.IDChild = b.ID

WHERE b.wfStatus LIKE '%'+ @Status+'%' AND (a.Requester LIKE @Requester OR @Requester IS NULL)

UNION

SELECT a.*,b.wfStatus FROM dbo.Approval a INNER JOIN dbo.[CR VM] b ON a.IDChild = b.ID

WHERE b.wfStatus LIKE '%'+ @Status+'%' AND (a.Requester LIKE @Requester OR @Requester IS NULL)

UNION

SELECT a.*,b.wfStatus FROM dbo.Approval a INNER JOIN dbo.[CR Physical] b ON a.IDChild = b.ID

WHERE b.wfStatus LIKE '%'+ @Status+'%' AND (a.Requester LIKE @Requester OR @Requester IS NULL)



GO
/****** Object:  Table [dbo].[Approval]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Approval](
	[ID] [uniqueidentifier] NOT NULL,
	[IDChild] [uniqueidentifier] NULL,
	[ApprovalDate] [datetime] NULL,
	[Approver] [varchar](200) NULL,
	[Modul] [varchar](200) NULL,
	[URL] [varchar](400) NULL,
	[Action] [varchar](200) NULL,
	[Comment] [varchar](max) NULL,
	[Requester] [varchar](200) NULL,
	[RequestDate] [datetime] NULL,
 CONSTRAINT [PK_Approval] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CheckList Network]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CheckList Network](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_Network] [uniqueidentifier] NULL,
	[Notes] [varchar](1000) NULL,
	[Date] [datetime] NULL,
	[InventoryBy] [varchar](200) NULL,
	[URLAttachment] [varchar](400) NULL,
	[CheckListBy] [varchar](200) NULL,
 CONSTRAINT [PK_CheckList Network] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Checklist Physical]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Checklist Physical](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_PhysicalServer] [uniqueidentifier] NULL,
	[Physical] [bit] NULL,
	[PowerSupply] [bit] NULL,
	[HDD] [bit] NULL,
	[Memory] [bit] NULL,
	[FAN] [bit] NULL,
	[Ethernet] [bit] NULL,
	[Notes] [varchar](1000) NULL,
	[Date] [datetime] NULL,
	[URLAttachment] [varchar](400) NULL,
	[CheckListBy] [varchar](200) NULL,
 CONSTRAINT [PK_Checklist Physical] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CheckList Storage]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CheckList Storage](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_Storage] [uniqueidentifier] NULL,
	[Physical] [bit] NULL,
	[PowerSupply] [bit] NULL,
	[HDD] [bit] NULL,
	[FAN] [bit] NULL,
	[Notes] [varchar](1000) NULL,
	[InventoryBy] [varchar](200) NULL,
	[Date] [datetime] NULL,
	[URLAttachment] [varchar](400) NULL,
	[CheckListBy] [varchar](200) NULL,
 CONSTRAINT [PK_CheckList Storage] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CheckList VM]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CheckList VM](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_VM] [uniqueidentifier] NULL,
	[Notes] [varchar](1000) NULL,
	[Date] [datetime] NULL,
	[InventoryBy] [varchar](200) NULL,
	[URLAttachment] [varchar](400) NULL,
	[CheckListBy] [varchar](200) NULL,
 CONSTRAINT [PK_CheckList VM] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CR Network]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CR Network](
	[ID] [uniqueidentifier] NOT NULL,
	[LabelName] [varchar](200) NULL,
	[wfStatus] [varchar](200) NULL,
	[Date] [datetime] NULL,
	[ID_Network] [uniqueidentifier] NULL,
	[Configuration] [varchar](200) NULL,
	[URLAttachment] [varchar](400) NULL,
	[CR_VLAN] [bit] NULL,
	[CR_LogicalConnection] [bit] NULL,
	[CR_Interface] [bit] NULL,
	[CR_System] [bit] NULL,
	[CR_Routing] [bit] NULL,
	[Location] [varchar](400) NULL,
	[IP] [varchar](400) NULL,
	[HostName] [varchar](200) NULL,
	[RackNumber] [varchar](200) NULL,
	[SystemClass] [varchar](200) NULL,
	[InventoryBy] [varchar](200) NULL,
	[RequestDetail] [varchar](max) NULL,
	[AffectedDevice] [varchar](max) NULL,
	[ErrorPossibility] [varchar](max) NULL,
 CONSTRAINT [PK_CR Network] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CR Physical]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CR Physical](
	[ID] [uniqueidentifier] NOT NULL,
	[LabelName] [varchar](200) NULL,
	[wfStatus] [varchar](200) NULL,
	[Date] [datetime] NULL,
	[Configuration] [varchar](400) NULL,
	[URLAttachment] [varchar](400) NULL,
	[CR_VLAN] [bit] NULL,
	[CR_LogicalConnection] [bit] NULL,
	[CR_Interface] [bit] NULL,
	[CR_System] [bit] NULL,
	[Location] [varchar](400) NULL,
	[IP] [varchar](200) NULL,
	[HostName] [varchar](200) NULL,
	[RackNumber] [varchar](200) NULL,
	[SystemClass] [varchar](200) NULL,
	[InventoryBy] [varchar](200) NULL,
	[ID_Physical] [uniqueidentifier] NULL,
 CONSTRAINT [PK_CR Physical] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CR Storage]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CR Storage](
	[ID] [uniqueidentifier] NOT NULL,
	[LabelName] [varchar](200) NULL,
	[wfStatus] [varchar](200) NULL,
	[Date] [datetime] NULL,
	[ID_Storage] [uniqueidentifier] NULL,
	[Configuration] [varchar](200) NULL,
	[URLAttachment] [varchar](400) NULL,
	[CR_VLAN] [bit] NULL,
	[CR_LogicalConnection] [bit] NULL,
	[CR_Interface] [bit] NULL,
	[CR_System] [bit] NULL,
	[Location] [varchar](400) NULL,
	[IP] [varchar](400) NULL,
	[HostName] [varchar](400) NULL,
	[RackNumber] [varchar](200) NULL,
	[SystemClass] [varchar](400) NULL,
	[InventoryBy] [varchar](400) NULL,
 CONSTRAINT [PK_CR Storage] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CR VM]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CR VM](
	[ID] [uniqueidentifier] NOT NULL,
	[LabelName] [varchar](200) NULL,
	[wfStatus] [varchar](200) NULL,
	[Date] [datetime] NULL,
	[ID_VM] [uniqueidentifier] NULL,
	[Configuration] [varchar](1000) NULL,
	[URLAttachment] [varchar](400) NULL,
	[CR_VLAN] [bit] NULL,
	[CR_LogicalConnection] [bit] NULL,
	[CR_Interface] [bit] NULL,
	[CR_System] [bit] NULL,
	[Location] [varchar](400) NULL,
	[IP] [varchar](200) NULL,
	[HostName] [varchar](400) NULL,
	[RackNumber] [varchar](200) NULL,
	[SystemClass] [varchar](200) NULL,
	[InventoryBy] [varchar](200) NULL,
 CONSTRAINT [PK_CR VM] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Data Cabang]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Data Cabang](
	[ID] [uniqueidentifier] NOT NULL,
	[wfStatus] [varchar](200) NULL,
	[ID_Router] [uniqueidentifier] NULL,
	[ID_NAS] [uniqueidentifier] NULL,
	[ID_Provider] [uniqueidentifier] NULL,
	[NamaCabang] [varchar](200) NULL,
	[KodeCabang] [varchar](100) NULL,
	[NamaLokasi] [varchar](200) NULL,
	[Alamat] [varchar](200) NULL,
	[SerialNumber] [varchar](200) NULL,
	[IPLAN] [varchar](200) NULL,
	[Bandwidth] [int] NULL,
	[NamaNAS] [varchar](200) NULL,
	[IPWAN] [varchar](200) NULL,
	[IPNAS] [varchar](200) NULL,
	[JumlahPC] [int] NULL,
	[JumlahNotebook] [int] NULL,
	[JumlahTC] [int] NULL,
	[Date] [datetime] NULL,
	[PIC] [varchar](200) NULL,
	[Telp] [varchar](200) NULL,
	[HP] [varchar](200) NULL,
	[Engineer] [varchar](200) NULL,
	[SID] [varchar](200) NULL,
 CONSTRAINT [PK_Data Cabang] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Data Kunjungan]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Data Kunjungan](
	[ID] [uniqueidentifier] NOT NULL,
	[wfStatus] [varchar](200) NULL,
	[Tanggal] [datetime] NULL,
	[ID_DataCabang] [uniqueidentifier] NULL,
	[KunjunganRutin] [bit] NULL,
	[TroubleCabang] [bit] NULL,
	[DeploymentUnit] [bit] NULL,
	[LainLain] [bit] NULL,
	[DeskripsiKunjungan] [varchar](200) NULL,
	[PICHO] [varchar](200) NULL,
	[DeskripsiLain2] [varchar](200) NULL,
 CONSTRAINT [PK_Data Kunjungan] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Deployment Printer]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Deployment Printer](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_Printer] [uniqueidentifier] NULL,
	[JmlPrinter] [int] NULL,
	[ID_DataKunjungan] [uniqueidentifier] NULL,
 CONSTRAINT [PK_Deployment Printer] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Deployment Unit]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Deployment Unit](
	[ID] [uniqueidentifier] NOT NULL,
	[JmlDesktop] [int] NULL,
	[JmlNotebook] [int] NULL,
	[JmlThinClient] [int] NULL,
	[ID_DataKunjungan] [uniqueidentifier] NULL,
 CONSTRAINT [PK_Deployment Unit] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Detail Printer]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Detail Printer](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_DataCabang] [uniqueidentifier] NOT NULL,
	[ID_Printer] [uniqueidentifier] NOT NULL,
	[Jumlah] [int] NULL,
 CONSTRAINT [PK_Detail Printer] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Inventory Network]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Inventory Network](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_SysBrand] [uniqueidentifier] NULL,
	[ID_SysType] [uniqueidentifier] NULL,
	[InventoryBy] [varchar](400) NULL,
	[InventoryDate] [datetime] NULL,
	[ID_RackNumber] [uniqueidentifier] NULL,
	[LabelName] [varchar](200) NULL,
	[SystemClass] [varchar](400) NULL,
	[ID_DataCabang] [uniqueidentifier] NULL,
	[StartFrom] [varchar](200) NULL,
	[IP] [varchar](200) NULL,
	[HostName] [varchar](200) NULL,
	[PathNumber] [varchar](200) NULL,
	[SerialNumber] [varchar](200) NULL,
	[LANPort] [int] NULL,
	[WANPort] [int] NULL,
	[FirmwareVersion] [varchar](200) NULL,
	[Notes] [varchar](1000) NULL,
	[URLAttachment] [varchar](400) NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Inventory Network] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Inventory Physical]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Inventory Physical](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_SysBrand] [uniqueidentifier] NULL,
	[ID_SysType] [uniqueidentifier] NULL,
	[InventoryBy] [varchar](200) NULL,
	[InventoryDate] [datetime] NULL,
	[ID_RackNumber] [uniqueidentifier] NULL,
	[LabelName] [varchar](200) NULL,
	[SystemClass] [varchar](200) NULL,
	[StartFrom] [varchar](200) NULL,
	[SystemDetail] [varchar](200) NULL,
	[IPManagement] [varchar](200) NULL,
	[IPHost] [varchar](200) NULL,
	[HostName] [varchar](200) NULL,
	[PathNumber] [varchar](200) NULL,
	[SerialNumber] [varchar](200) NULL,
	[Processor] [int] NULL,
	[Core] [int] NULL,
	[RAM] [int] NULL,
	[JumlahRAM] [int] NULL,
	[HDD] [int] NULL,
	[KapasitasHDD] [int] NULL,
	[RaidDetail] [varchar](200) NULL,
	[ID_DataCabang] [uniqueidentifier] NULL,
	[ID_OperatingSystem] [uniqueidentifier] NULL,
	[Application] [varchar](200) NULL,
	[HW_Physical] [bit] NULL,
	[HW_PowerSupply] [bit] NULL,
	[HW_HDD] [bit] NULL,
	[HW_Memory] [bit] NULL,
	[HW_FAN] [bit] NULL,
	[HW_Ethernet] [bit] NULL,
	[HW_Notes] [varchar](1000) NULL,
	[URLAttachment] [varchar](400) NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Inventory Physical] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Inventory Storage]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Inventory Storage](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_SysBrand] [uniqueidentifier] NULL,
	[ID_SysType] [uniqueidentifier] NULL,
	[InventoryBy] [varchar](200) NULL,
	[InventoryDate] [datetime] NULL,
	[ID_RackNumber] [uniqueidentifier] NULL,
	[LabelName] [varchar](200) NULL,
	[SystemClass] [varchar](400) NULL,
	[ID_DataCabang] [uniqueidentifier] NULL,
	[StartFrom] [varchar](200) NULL,
	[PathNumber] [varchar](200) NULL,
	[SerialNumber] [varchar](200) NULL,
	[HDD] [int] NULL,
	[HDDCapacity] [int] NULL,
	[HW_Physical] [bit] NULL,
	[HW_Supply] [bit] NULL,
	[HW_HDD] [bit] NULL,
	[HW_FAN] [bit] NULL,
	[Notes] [varchar](1000) NULL,
	[HostName] [varchar](200) NULL,
	[IP] [varchar](200) NULL,
	[URLAttachment] [varchar](400) NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Inventory Storage] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Inventory VM]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Inventory VM](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_SysBrand] [uniqueidentifier] NULL,
	[ID_SysType] [uniqueidentifier] NULL,
	[InventoryBy] [varchar](200) NULL,
	[InventoryDate] [datetime] NULL,
	[ID_RackNumber] [uniqueidentifier] NULL,
	[ID_LabelName] [uniqueidentifier] NULL,
	[Date] [datetime] NULL,
	[SystemClass] [varchar](200) NULL,
	[StartFrom] [varchar](200) NULL,
	[SystemDetail] [varchar](200) NULL,
	[Host_Name] [varchar](200) NULL,
	[Host_IP] [varchar](200) NULL,
	[ID_DataCabang] [uniqueidentifier] NULL,
	[ID_OperatingSystem] [uniqueidentifier] NULL,
	[Guest_Application] [varchar](200) NULL,
	[Guest_Processor] [int] NULL,
	[Guest_Disk] [int] NULL,
	[Guest_Memory] [int] NULL,
	[Guest_Notes] [varchar](1000) NULL,
	[Guest_DiskCapacity] [int] NULL,
	[URLAttachment] [varchar](400) NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Inventory VM] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Location]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Location](
	[ID] [uniqueidentifier] NOT NULL,
	[Kode] [varchar](200) NULL,
	[Nama] [varchar](200) NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Location] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Modul Detail]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Modul Detail](
	[ID] [uniqueidentifier] NOT NULL,
	[ModulName] [varchar](400) NULL,
	[PathNumber] [varchar](200) NULL,
	[SerialNumber] [varchar](200) NULL,
	[SlotName] [varchar](400) NULL,
	[ID_Network] [uniqueidentifier] NULL,
 CONSTRAINT [PK_Modul Detail] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[NAS]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[NAS](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NOT NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_NAS] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Operating System]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Operating System](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NOT NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_OperatingSystem] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Pick Up]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Pick Up](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_WorkOrder] [uniqueidentifier] NULL,
	[Item] [varchar](200) NULL,
	[Quantity] [int] NULL,
	[SerialNumber] [varchar](200) NULL,
	[Accessories] [varchar](200) NULL,
 CONSTRAINT [PK_Pick Up] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Printer]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Printer](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NOT NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Printer] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Provider]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Provider](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NOT NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Provider] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Rack Number]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Rack Number](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_RackNumber] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Router]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Router](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NOT NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Router] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[RPMonth]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[RPMonth](
	[ID] [int] NOT NULL,
	[Title] [varchar](200) NULL,
	[IsDeleted] [bit] NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[RPYear]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[RPYear](
	[ID] [int] NOT NULL,
	[Title] [varchar](200) NULL,
	[IsDeleted] [bit] NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[System Brand]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[System Brand](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NOT NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_SystemBrand] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[System Type]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[System Type](
	[ID] [uniqueidentifier] NOT NULL,
	[ID_SystemBrand] [uniqueidentifier] NULL,
	[Title] [varchar](200) NOT NULL,
	[Size] [int] NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_SystemType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Trouble Cabang]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Trouble Cabang](
	[ID] [uniqueidentifier] NOT NULL,
	[Jenis] [varchar](200) NULL,
	[Solusi] [varchar](1000) NULL,
	[ID_DataKunjungan] [uniqueidentifier] NULL,
 CONSTRAINT [PK_Trouble Cabang] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Vendor]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Vendor](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [varchar](200) NOT NULL,
	[Name] [varchar](200) NULL,
	[IsDeleted] [bit] NULL,
 CONSTRAINT [PK_Vendor] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Work Order]    Script Date: 2/13/2014 3:46:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Work Order](
	[ID] [uniqueidentifier] NOT NULL,
	[NoWO] [varchar](200) NULL,
	[Date] [datetime] NULL,
	[ID_LabelName] [uniqueidentifier] NULL,
	[ID_Vendor] [uniqueidentifier] NULL,
	[Name] [varchar](200) NULL,
	[PIC] [varchar](200) NULL,
	[Svc_SysConfig] [bit] NULL,
	[Svc_Troubleshooting] [bit] NULL,
	[Svc_Hardware] [bit] NULL,
	[Svc_DataBackup] [bit] NULL,
	[Svc_Software] [bit] NULL,
	[Svc_Upgrade] [bit] NULL,
	[Description] [varchar](1000) NULL,
	[Note] [varchar](1000) NULL,
	[StartDate] [datetime] NULL,
	[FinishDate] [datetime] NULL,
	[ID_PickUp] [uniqueidentifier] NULL,
	[URLAttachment] [varchar](400) NULL,
 CONSTRAINT [PK_Work Order] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Data Cabang]  WITH CHECK ADD  CONSTRAINT [FK_Data Cabang_NAS] FOREIGN KEY([ID_NAS])
REFERENCES [dbo].[NAS] ([ID])
GO
ALTER TABLE [dbo].[Data Cabang] CHECK CONSTRAINT [FK_Data Cabang_NAS]
GO
ALTER TABLE [dbo].[Data Cabang]  WITH CHECK ADD  CONSTRAINT [FK_Data Cabang_Provider] FOREIGN KEY([ID_Provider])
REFERENCES [dbo].[Provider] ([ID])
GO
ALTER TABLE [dbo].[Data Cabang] CHECK CONSTRAINT [FK_Data Cabang_Provider]
GO
ALTER TABLE [dbo].[Data Cabang]  WITH CHECK ADD  CONSTRAINT [FK_Data Cabang_Router] FOREIGN KEY([ID_Router])
REFERENCES [dbo].[Router] ([ID])
GO
ALTER TABLE [dbo].[Data Cabang] CHECK CONSTRAINT [FK_Data Cabang_Router]
GO
ALTER TABLE [dbo].[Data Kunjungan]  WITH CHECK ADD  CONSTRAINT [FK_Data Kunjungan_Data Cabang] FOREIGN KEY([ID_DataCabang])
REFERENCES [dbo].[Data Cabang] ([ID])
GO
ALTER TABLE [dbo].[Data Kunjungan] CHECK CONSTRAINT [FK_Data Kunjungan_Data Cabang]
GO
ALTER TABLE [dbo].[Deployment Printer]  WITH CHECK ADD  CONSTRAINT [FK_Deployment Printer_Data Kunjungan] FOREIGN KEY([ID_DataKunjungan])
REFERENCES [dbo].[Data Kunjungan] ([ID])
GO
ALTER TABLE [dbo].[Deployment Printer] CHECK CONSTRAINT [FK_Deployment Printer_Data Kunjungan]
GO
ALTER TABLE [dbo].[Deployment Unit]  WITH CHECK ADD  CONSTRAINT [FK_Deployment Unit_Data Kunjungan] FOREIGN KEY([ID_DataKunjungan])
REFERENCES [dbo].[Data Kunjungan] ([ID])
GO
ALTER TABLE [dbo].[Deployment Unit] CHECK CONSTRAINT [FK_Deployment Unit_Data Kunjungan]
GO
ALTER TABLE [dbo].[Detail Printer]  WITH CHECK ADD  CONSTRAINT [FK_Detail Printer_Data Cabang] FOREIGN KEY([ID_DataCabang])
REFERENCES [dbo].[Data Cabang] ([ID])
GO
ALTER TABLE [dbo].[Detail Printer] CHECK CONSTRAINT [FK_Detail Printer_Data Cabang]
GO
ALTER TABLE [dbo].[Detail Printer]  WITH CHECK ADD  CONSTRAINT [FK_Detail Printer_Printer] FOREIGN KEY([ID_Printer])
REFERENCES [dbo].[Printer] ([ID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Detail Printer] CHECK CONSTRAINT [FK_Detail Printer_Printer]
GO
ALTER TABLE [dbo].[Inventory Physical]  WITH CHECK ADD  CONSTRAINT [FK_Inventory Physical_Data Cabang] FOREIGN KEY([ID_DataCabang])
REFERENCES [dbo].[Location] ([ID])
GO
ALTER TABLE [dbo].[Inventory Physical] CHECK CONSTRAINT [FK_Inventory Physical_Data Cabang]
GO
ALTER TABLE [dbo].[Inventory Physical]  WITH CHECK ADD  CONSTRAINT [FK_Inventory Physical_Operating System] FOREIGN KEY([ID_OperatingSystem])
REFERENCES [dbo].[Operating System] ([ID])
GO
ALTER TABLE [dbo].[Inventory Physical] CHECK CONSTRAINT [FK_Inventory Physical_Operating System]
GO
ALTER TABLE [dbo].[Inventory Physical]  WITH CHECK ADD  CONSTRAINT [FK_Inventory Physical_System Brand] FOREIGN KEY([ID_SysBrand])
REFERENCES [dbo].[System Brand] ([ID])
GO
ALTER TABLE [dbo].[Inventory Physical] CHECK CONSTRAINT [FK_Inventory Physical_System Brand]
GO
ALTER TABLE [dbo].[Inventory Physical]  WITH CHECK ADD  CONSTRAINT [FK_Inventory Physical_System Type] FOREIGN KEY([ID_SysType])
REFERENCES [dbo].[System Type] ([ID])
GO
ALTER TABLE [dbo].[Inventory Physical] CHECK CONSTRAINT [FK_Inventory Physical_System Type]
GO
ALTER TABLE [dbo].[Inventory Storage]  WITH CHECK ADD  CONSTRAINT [FK_Inventory Storage_Data Cabang] FOREIGN KEY([ID_DataCabang])
REFERENCES [dbo].[Location] ([ID])
GO
ALTER TABLE [dbo].[Inventory Storage] CHECK CONSTRAINT [FK_Inventory Storage_Data Cabang]
GO
ALTER TABLE [dbo].[Inventory Storage]  WITH CHECK ADD  CONSTRAINT [FK_Inventory Storage_System Brand] FOREIGN KEY([ID_SysBrand])
REFERENCES [dbo].[System Brand] ([ID])
GO
ALTER TABLE [dbo].[Inventory Storage] CHECK CONSTRAINT [FK_Inventory Storage_System Brand]
GO
ALTER TABLE [dbo].[Inventory Storage]  WITH CHECK ADD  CONSTRAINT [FK_Inventory Storage_System Type] FOREIGN KEY([ID_SysType])
REFERENCES [dbo].[System Type] ([ID])
GO
ALTER TABLE [dbo].[Inventory Storage] CHECK CONSTRAINT [FK_Inventory Storage_System Type]
GO
ALTER TABLE [dbo].[Inventory VM]  WITH CHECK ADD  CONSTRAINT [FK_Inventory VM_Data Cabang] FOREIGN KEY([ID_DataCabang])
REFERENCES [dbo].[Location] ([ID])
GO
ALTER TABLE [dbo].[Inventory VM] CHECK CONSTRAINT [FK_Inventory VM_Data Cabang]
GO
ALTER TABLE [dbo].[Inventory VM]  WITH CHECK ADD  CONSTRAINT [FK_Inventory VM_Operating System] FOREIGN KEY([ID_OperatingSystem])
REFERENCES [dbo].[Operating System] ([ID])
GO
ALTER TABLE [dbo].[Inventory VM] CHECK CONSTRAINT [FK_Inventory VM_Operating System]
GO
ALTER TABLE [dbo].[Inventory VM]  WITH CHECK ADD  CONSTRAINT [FK_Inventory VM_System Brand] FOREIGN KEY([ID_SysBrand])
REFERENCES [dbo].[System Brand] ([ID])
GO
ALTER TABLE [dbo].[Inventory VM] CHECK CONSTRAINT [FK_Inventory VM_System Brand]
GO
ALTER TABLE [dbo].[Inventory VM]  WITH CHECK ADD  CONSTRAINT [FK_Inventory VM_System Type] FOREIGN KEY([ID_SysType])
REFERENCES [dbo].[System Type] ([ID])
GO
ALTER TABLE [dbo].[Inventory VM] CHECK CONSTRAINT [FK_Inventory VM_System Type]
GO
ALTER TABLE [dbo].[Modul Detail]  WITH CHECK ADD  CONSTRAINT [FK_Modul Detail_Inventory Network] FOREIGN KEY([ID_Network])
REFERENCES [dbo].[Inventory Network] ([ID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Modul Detail] CHECK CONSTRAINT [FK_Modul Detail_Inventory Network]
GO
ALTER TABLE [dbo].[Pick Up]  WITH CHECK ADD  CONSTRAINT [FK_Pick Up_Work Order] FOREIGN KEY([ID_WorkOrder])
REFERENCES [dbo].[Work Order] ([ID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Pick Up] CHECK CONSTRAINT [FK_Pick Up_Work Order]
GO
ALTER TABLE [dbo].[Trouble Cabang]  WITH CHECK ADD  CONSTRAINT [FK_Trouble Cabang_Data Kunjungan] FOREIGN KEY([ID_DataKunjungan])
REFERENCES [dbo].[Data Kunjungan] ([ID])
GO
ALTER TABLE [dbo].[Trouble Cabang] CHECK CONSTRAINT [FK_Trouble Cabang_Data Kunjungan]
GO
USE [master]
GO
ALTER DATABASE [InventoryManagement] SET  READ_WRITE 
GO
